package com.bizzan.bitrade;

import com.bizzan.bitrade.util.IdWorkByTwitter;
import com.bizzan.bitrade.util.Md5;
import org.apache.shiro.util.ByteSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class testRegister {
    @Autowired
    private IdWorkByTwitter idWorkByTwitter;

    @Test
    public void registerTest(){
        //不可重复随机数
        String loginNo = String.valueOf(idWorkByTwitter.nextId());
        //盐
        String credentialsSalt = ByteSource.Util.bytes(loginNo).toHex();
        //生成密码
        try {
            String password = Md5.md5Digest("123456" + credentialsSalt).toLowerCase();
            System.out.println("加密后的密码为:"+password);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
